<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--
        去除"abcdeereeryhhssqqq"中的重复字符
-->

<script>

    var str = 'abcdeereeryhhssqqq'

    function fn(str) {
        var newAaary = []
        //遍历数组将数组中的元素 添加到新数组中  保证新数组中的元素不重复
        for (var i = 0; i < str.length; i++) {
            if (newAaary.indexOf(str[i]) == -1) {
                newAaary.push(str[i])
            }
        }
        // 将数组中的元素 拼接成字符串
        return newAaary.join('');
    }

    var s = fn(str);
    console.log(s)


</script>
</body>
</html>